home *** CD-ROM | disk | FTP | other *** search
/ Enigma Amiga Life 109 / EnigmaAmiga109CD.iso / dalla rivista / host contacted / jikes.lha / jikes-1.11 / src / access.h next >
C/C++ Source or Header  |  1999-07-06  |  4KB  |  98 lines

  1. // $Id: access.h,v 1.7 1999/07/06 13:49:15 shields Exp $
  2. //
  3. // This software is subject to the terms of the IBM Jikes Compiler
  4. // License Agreement available at the following URL:
  5. // http://www.ibm.com/research/jikes.
  6. // Copyright (C) 1996, 1998, International Business Machines Corporation
  7. // and others.  All Rights Reserved.
  8. // You must accept the terms of that agreement to use this software.
  9. //
  10.  
  11. #ifndef access_INCLUDED
  12. #define access_INCLUDED
  13.  
  14. #include "config.h"
  15.  
  16. class AccessFlags
  17. {
  18. protected:
  19.     u2 access_flags;
  20.  
  21. public:
  22.  
  23.     bool ACC_PUBLIC()       { return (access_flags & 0x0001) != 0; }
  24.     bool ACC_PRIVATE()      { return (access_flags & 0x0002) != 0; }
  25.     bool ACC_PROTECTED()    { return (access_flags & 0x0004) != 0; }
  26.     bool ACC_STATIC()       { return (access_flags & 0x0008) != 0; }
  27.     bool ACC_FINAL()        { return (access_flags & 0x0010) != 0; }
  28.     bool ACC_SUPER()        { return (access_flags & 0x0020) != 0; }
  29.     bool ACC_SYNCHRONIZED() { return (access_flags & 0x0020) != 0; }
  30.     bool ACC_VOLATILE()     { return (access_flags & 0x0040) != 0; }
  31.     bool ACC_TRANSIENT()    { return (access_flags & 0x0080) != 0; }
  32.     bool ACC_NATIVE()       { return (access_flags & 0x0100) != 0; }
  33.     bool ACC_INTERFACE()    { return (access_flags & 0x0200) != 0; }
  34.     bool ACC_ABSTRACT()     { return (access_flags & 0x0400) != 0; }
  35.     bool ACC_STRICTFP()     { return (access_flags & 0x0800) != 0; }
  36.  
  37.     void SetACC_PUBLIC()       { access_flags |= 0x0001; }
  38.     void SetACC_PRIVATE()      { access_flags |= 0x0002; }
  39.     void SetACC_PROTECTED()    { access_flags |= 0x0004; }
  40.     void SetACC_STATIC()       { access_flags |= 0x0008; }
  41.     void SetACC_FINAL()        { access_flags |= 0x0010; }
  42.     void SetACC_SUPER()        { access_flags |= 0x0020; }
  43.     void SetACC_SYNCHRONIZED() { access_flags |= 0x0020; }
  44.     void SetACC_VOLATILE()     { access_flags |= 0x0040; }
  45.     void SetACC_TRANSIENT()    { access_flags |= 0x0080; }
  46.     void SetACC_NATIVE()       { access_flags |= 0x0100; }
  47.     void SetACC_INTERFACE()    { access_flags |= 0x0200; }
  48.     void SetACC_ABSTRACT()     { access_flags |= 0x0400; }
  49.     void SetACC_STRICTFP()     { access_flags |= 0x0800; }
  50.  
  51.     void ResetACC_PUBLIC()       { access_flags &= (~ 0x0001); }
  52.     void ResetACC_PRIVATE()      { access_flags &= (~ 0x0002); }
  53.     void ResetACC_PROTECTED()    { access_flags &= (~ 0x0004); }
  54.     void ResetACC_STATIC()       { access_flags &= (~ 0x0008); }
  55.     void ResetACC_FINAL()        { access_flags &= (~ 0x0010); }
  56.     void ResetACC_SUPER()        { access_flags &= (~ 0x0020); }
  57.     void ResetACC_SYNCHRONIZED() { access_flags &= (~ 0x0020); }
  58.     void ResetACC_VOLATILE()     { access_flags &= (~ 0x0040); }
  59.     void ResetACC_TRANSIENT()    { access_flags &= (~ 0x0080); }
  60.     void ResetACC_NATIVE()       { access_flags &= (~ 0x0100); }
  61.     void ResetACC_INTERFACE()    { access_flags &= (~ 0x0200); }
  62.     void ResetACC_ABSTRACT()     { access_flags &= (~ 0x0400); }
  63.     void ResetACC_STRICTFP()     { access_flags &= (~ 0x0800); }
  64.  
  65.     void ResetFlags() { access_flags = 0; }
  66.     void SetFlags(u2 access_flags_) { access_flags = access_flags_; }
  67.     void SetFlags(AccessFlags af)  { this -> access_flags = af.access_flags; }
  68.     u2 Flags() { return access_flags; }
  69.  
  70.     AccessFlags() : access_flags(0) {}
  71.     AccessFlags(u2& _access_flags) : access_flags(_access_flags) {}
  72.  
  73. #ifdef TEST
  74.     void Print()
  75.     {
  76.         Coutput << " access_flags: ";
  77.         if (ACC_PUBLIC())       Coutput << " public";
  78.         if (ACC_PRIVATE())      Coutput << " private";
  79.         if (ACC_PROTECTED())    Coutput << " protected";
  80.         if (ACC_STATIC())       Coutput << " static";
  81.         if (ACC_FINAL())        Coutput << " final";
  82.         // super and synchronized use the same bit!
  83.         if (ACC_SYNCHRONIZED()) Coutput << " super_or_synchronized";
  84.         if (ACC_VOLATILE())     Coutput << " volatile";
  85.         if (ACC_TRANSIENT())    Coutput << " transient";
  86.         if (ACC_NATIVE())       Coutput << " native";
  87.         if (ACC_INTERFACE())    Coutput << " interface";
  88.         if (ACC_ABSTRACT())     Coutput << " abstract";
  89.         if (ACC_STRICTFP())     Coutput << " strictfp";
  90.         Coutput << "\n";
  91.     }
  92. #endif
  93. };
  94.  
  95. #endif
  96.  
  97.  
  98.